﻿@page "/gantt-chart/sorting"
@using Syncfusion.Blazor.Gantt
@using ej2_blazor_defaultdata
@inherits SampleBaseComponent;

<SampleDescription>
    <p>This sample demonstrates the Gantt multi-sorting feature. Sorting enables you to sort data in the ascending or descending order.</p>
</SampleDescription>
<ActionDescription>
    <p>The sorting feature enables you to order data in a particular direction. It can be enabled by setting <code>AllowSorting</code> to true.</p>    
    <p>To sort a Gantt column, click the column header. The icons (ascending) and (descending) specifies the sort direction of a column.</p>
    <p>By default, the multi-sorting feature is enabled in Gantt. To sort multiple columns, hold the CTRL key, and then click the column header. To clear sort for a column, hold the SHIFT key, and then click the column header.</p>
    <p>In this demo, multiple sorting is enabled on load time by assigning multiple columns into the <code>SortSettings</code> property.</p>
    <p>More information about Sorting can be found in this <code><a target='_blank' class='code' href='https://blazor.syncfusion.com/documentation/gantt-chart/columns/#reordering'>documentation</a></code> section.</p>
</ActionDescription>

<div class="control-section">
    <div class="row">
        <div class="col-md-12">
            <SfGantt DataSource="@TaskCollection" Height="450px" Width="100%" HighlightWeekends="true"
                     ProjectStartDate="@ProjectStart" ProjectEndDate="@ProjectEnd" AllowSorting="true">
                <GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress"
                                 Dependency="Predecessor" ParentID="ParentId"></GanttTaskFields>
                <GanttLabelSettings LeftLabel="TaskName" TValue="DefaultData.TaskData"> </GanttLabelSettings>
                <GanttSplitterSettings Position="30%"> </GanttSplitterSettings>
            </SfGantt>
        </div>
    </div>
</div>

@code{
    public DateTime ProjectStart = new DateTime(2019, 3, 24);
    public DateTime ProjectEnd = new DateTime(2019, 7, 6);
    public List<DefaultData.TaskData> TaskCollection { get; set; }

    protected override void OnInitialized()
    {
        this.TaskCollection = DefaultData.ProjectNewData();
    }
}
